import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GymRefundRuleVO, GymRefundRuleForm, GymRefundRuleQuery } from '@/api/primary/gymRefundRule/types';

/**
 * 查询退票规则列表
 * @param query
 * @returns {*}
 */

export const listGymRefundRule = (query?: GymRefundRuleQuery): AxiosPromise<GymRefundRuleVO[]> => {
  return request({
    url: '/primary/gymRefundRule/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询退票规则详细
 * @param id
 */
export const getGymRefundRule = (id: string | number): AxiosPromise<GymRefundRuleVO> => {
  return request({
    url: '/primary/gymRefundRule/' + id,
    method: 'get'
  });
};

/**
 * 新增退票规则
 * @param data
 */
export const addGymRefundRule = (data: GymRefundRuleForm) => {
  return request({
    url: '/primary/gymRefundRule',
    method: 'post',
    data: data
  });
};

/**
 * 修改退票规则
 * @param data
 */
export const updateGymRefundRule = (data: GymRefundRuleForm) => {
  return request({
    url: '/primary/gymRefundRule',
    method: 'put',
    data: data
  });
};

/**
 * 删除退票规则
 * @param id
 */
export const delGymRefundRule = (id: string | number | Array<string | number>) => {
  return request({
    url: '/primary/gymRefundRule/' + id,
    method: 'delete'
  });
};
